package com.bensonbasement.snorflux.client.states;

import com.bensonbasement.snorflux.client.SnorfluxClient;
import com.bensonbasement.snorflux.messages.fromserver.JoinedMessage;
import com.bensonbasement.snorflux.messages.fromserver.PlayerInfo;

public class ConnectingState extends DisconnectedState {
	
	public ConnectingState(SnorfluxClient client) {
		super(client);
	}
	
	@Override
	public void handleConnected(JoinedMessage message) {
		getChatPanel().postMessage("Connected.");
		for (PlayerInfo player : message.getPlayerList()) {
			getPlayerListModel().addInfo(player);
		}
		setMemory(message.getMemory());
		changeState(new IdleState(client));
	}
}
